package com.x.erp.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.MultilevelActivityBondDao;
import com.x.erp.model.MultilevelActivityBond;
import com.x.erp.rpc.MultilevelActivityBondRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 多级营销活动保证金服务
 */
@Component
@Service(interfaceName = "com.x.erp.rpc.MultilevelActivityBondRpcService", timeout = 60000)
public class MultilevelActivityBondService extends BaseService implements MultilevelActivityBondRpcService {

	@Autowired
	private MultilevelActivityBondDao multilevelActivityBondDao;//多级营销活动保证金信息DAO

	/**
	 * 查询多级营销活动保证金列表
	 * @param multilevelActivityBond
	 * @return
	 */
	@Override
	public List<MultilevelActivityBond> selectMultilevelActivityBondList(MultilevelActivityBond multilevelActivityBond){
		try {
			return multilevelActivityBondDao.selectMultilevelActivityBondList(multilevelActivityBond);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 查询多级营销活动保证金数量
	 * @param multilevelActivityBond
	 * @return
	 */
	@Override
	public int selectMultilevelActivityBondNum(MultilevelActivityBond multilevelActivityBond){
		try {
			return multilevelActivityBondDao.selectMultilevelActivityBondNum(multilevelActivityBond);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 新增多级营销活动保证金信息
	 * @param multilevelActivityBond
	 * @return
	 */
	@Override
	public MultilevelActivityBond insertMultilevelActivityBond(MultilevelActivityBond multilevelActivityBond){
		try {
			return this.insert(multilevelActivityBond);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	/**
	 * 修改多级营销活动保证金信息
	 * @param multilevelActivityBond
	 * @return
	 */
	@Override
	public int updateMultilevelActivityBond(MultilevelActivityBond multilevelActivityBond){
		try {
			return this.update(multilevelActivityBond);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
